//
//  sendRequestViewController.m
//  FastRunDemo
//
//  Created by 苟亚明 on 16/9/21.
//  Copyright © 2016年 苟亚明. All rights reserved.
//

#import "sendRequestViewController.h"

@interface sendRequestViewController () <UITextViewDelegate>
/** 占位label*/
@property (weak, nonatomic) IBOutlet UILabel *lblPlacehouder;

@property (weak, nonatomic) IBOutlet UITextView *textView;
/** 地点textFiled*/
@property (weak, nonatomic) IBOutlet UITextField *textFiledPlace;
/** 小费textField*/
@property (weak, nonatomic) IBOutlet UITextField *textFieldMoney;
/** 开关*/
@property (weak, nonatomic) IBOutlet UISwitch *swich;
/** 面对的人群*/
@property (weak, nonatomic) IBOutlet UILabel *lblPeople;

@end

@implementation sendRequestViewController

#pragma mark - ViewLife

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"我想要";
    
    self.navigationItem.leftBarButtonItem = [UIBarButtonItem itemWithImage:@"btn_del" highImage:@"btn_del" target:self action:@selector(leftBtnClick)];
    self.textView.delegate = self;
    
    [self.swich addTarget:self action:@selector(swichChange) forControlEvents:UIControlEventValueChanged];
    
}
#pragma mark - action
// 增加小费
- (IBAction)btnAddClicl:(id)sender {
    NSString *conut = self.textFieldMoney.text;
    int money = (int)[conut doubleValue];
    self.textFieldMoney.text =  [NSString stringWithFormat:@"%d",++money];
}
// 减少小费
- (IBAction)btnReduceClick:(id)sender {
    NSString *conut = self.textFieldMoney.text;
    int money = (int)[conut doubleValue];
    self.textFieldMoney.text =  [NSString stringWithFormat:@"%d",--money];
}

// 导航栏左边按钮点击事件
- (void)leftBtnClick{
    [self dismissViewControllerAnimated:YES completion:nil];
}
// 发送按钮点击事件
- (IBAction)btnSendClick:(id)sender {
}

// 开关点击触发事件
- (void)swichChange{
    if(self.swich.on){
        self.lblPeople.text = @"所有人";
    }else{
        self.lblPeople.text = @"专业团队";
    }
}
#pragma mark - UITextViewDelegate
- (void)textViewDidChange:(UITextView *)textView{
    if (self.textView.text > 0) {
        self.lblPlacehouder.hidden = YES;
    }else{
        self.lblPlacehouder.hidden = NO;
    }
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    [self.view endEditing:YES];
    
}


@end
